from loguru import logger
import datetime
#控制台不输出
logger.remove(handler_id=None)
logger.add(f"logs/{datetime.datetime.now().date()}.log", filter=lambda record: record["extra"]["name"] == "logger")
logger.add(f"logs/{datetime.datetime.now().date()}_sql.log", filter=lambda record: record["extra"]["name"] == "logger_sql")

# 这个bind()函数就是在extra里额外增加键值
logger = logger.bind(name="logger")
logger_sql = logger.bind(name="logger_sql")